<%@page pageEncoding="UTF-8" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html>
<html lang="zh-cmn">
<head>
    <%@include file="/WEB-INF/page/comm/head.jsp"%>
</head>
<body>
<div class="container">
    <h3 id="tit">用户管理</h3>
    <button class="btn btn-primary" type="button" onclick="add()">添加用户</button>
    <table class="table table-bordered table-striped">
        <tr>
            <th>用户编号</th>
            <th>名称</th>
            <th>生日</th>
            <th>电话</th>
            <th>地址</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${list}" var="u">
            <tr>
                <td>${u.userCode}</td>
                <td>${u.userName}</td>
                <fmt:formatDate value="${u.birthday}" pattern="yyyy-MM-dd" var="fd"/>
                <td>${fd}</td>
                <td>${u.phone}</td>
                <td>${u.address}</td>
                <td>
                    <a href="javascript:addCard()" class="btn btn-danger btn-sm">上传证件</a>
                    &nbsp;<a href="javascript:showInfo(${u.id})" class="btn btn-success btn-sm">详细信息</a>
                </td>
            </tr>
        </c:forEach>
    </table>


    <div id="addCard">
  <form class="form-horizontal">
        <div class="form-group">
            <label for="" class="col-md-3">请选择证件：</label>
            <div class="col-md-8">
            <input type="file" name="cardPic" class="form-control"/>
            </div>
            </div>
      <div class="form-group">
          <label for="" class="col-md-3">证件描述：</label>
          <div class="col-md-8">
          <textarea class="form-control"></textarea>
          </div>
      </div>
  </form>
    </div>




</div>

<div id="detail">
    <p>
        <label>用户名:</label><span></span>
    </p>
    <p>
        <label>性别:</label><span></span>
    </p>
    <p>
        <label>电话:</label><span></span>
    </p>
    <p>
    <label>地址:</label><span></span>
</p>
    <p>
        <label>出生日期:</label><span></span>
    </p>
</div>


<%@include file="/WEB-INF/page/comm/foot.jsp"%>
<script>
    $(function(){
        $("#addCard").dialog({title:'添加证件',
            btnName:'确认添加',
            btnBind:function(){
               alert("dfsaf");
            }
        });
    });
    function addCard(){
       // $("#addCard").dialog("open");
        location=ctx+"user/card";
    }
    function showInfo(id){
        $.get(ctx+"user/detail/"+id,function(u){
            $("#detail").find("span:eq(0)").html(u.userName);
            $("#detail").find("span:eq(1)").html(u.gender==1?"男":"女");
            $("#detail").find("span:eq(2)").html(u.phone);
            $("#detail").find("span:eq(3)").html(u.address);
            $("#detail").find("span:eq(4)").html(u.birthday);
            $("#detail").dialog("open");

        },'json');
    }
    $(function(){
        $("#detail").dialog({title:"用户详细信息"});
    });

    function add(){
        location=ctx+"user/add";
    }
</script>
</body>
</html>
